package com.lianbang.staff.dialog

import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import cn.ubest.mvvmcore.base.BaseDialogFragment
import cn.ubest.mvvmcore.utils.ResourcesUtils
import cn.ubest.mvvmcore.widget.ListDivider
import com.lianbang.staff.R
import com.lianbang.staff.adapter.TodayIncomeListAdapter
import com.lianbang.staff.databinding.DialogTodayIncomeBinding
import kotlinx.android.synthetic.main.dialog_today_income.*

/**
 * Created by maoqi on 2021/1/13.
 */
class AddOrderDialog : BaseDialogFragment<DialogTodayIncomeBinding>() {

    companion object {
        fun newInstance(): AddOrderDialog {
            val args = Bundle()
            val fragment = AddOrderDialog()
            fragment.arguments = args
            return fragment
        }
    }

    override fun initLayout(): Int {
        return R.layout.dialog_today_income
    }

    override fun initData(arguments: Bundle?) {

    }

    override fun initView(view: View) {
        setWidth(ResourcesUtils.getDimens(R.dimen.dp_335))
        setHeight(ResourcesUtils.getDimens(R.dimen.dp_450))
        tv_title.text = "新增订单"
        btn_cancel.setOnClickListener {
            finishSelf()
        }
        view.findViewById<RecyclerView?>(R.id.rv_list)?.apply {
            layoutManager = LinearLayoutManager(activity)
            addItemDecoration(
                ListDivider.Build()
                    .setColor(R.color.C_F3F5F9)
                    .setMarginLeft(R.dimen.dp_20)
                    .setMarinRight(R.dimen.dp_20)
                    .build()
            )
            adapter = TodayIncomeListAdapter().run {
                replaceData(
                    mutableListOf(
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        ""
                    )
                )
                this
            }
        }
    }

    override fun loadData() {
    }

}